import Vue from 'vue'
import Router from 'vue-router'
import '@/style/index.scss'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Login from '@/views/Login.vue'
import Home from '@/views/Home.vue'
import Users from '@/views/users/Users.vue'
import Rights from '@/views/role/Rights.vue'
import Roles from '@/views/role/Roles.vue'
import Goods from '@/views/goods/Goods.vue'
import Categories from '@/views/goods/Categories.vue'
import Params from '@/views/goods/Params.vue'
import List from '@/views/goods/GoodsList.vue'
import Add from '@/views/goods/GoodsAdd.vue'
import Orders from '@/views/orders/Orders.vue'
import Reports from '@/views/reports/Reports.vue'

Vue.use(Router)
Vue.use(ElementUI)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      children: [
        {
          path: 'users',
          name: 'Users',
          component: Users
        },
        {
          path: 'rights',
          name: 'Rights',
          component: Rights
        },
        {
          path: 'roles',
          name: 'Roles',
          component: Roles
        },
        {
          path: 'goods',
          name: 'Goods',
          component: Goods,
          redirect: {
            path: 'goods/list'
          },
          children: [
            {
              path: 'list',
              name: 'List',
              component: List
            },
            {
              path: 'add',
              name: 'Add',
              component: Add
            }
          ]
        },
        {
          path: 'categories',
          name: 'Categories',
          component: Categories
        },
        {
          path: 'params',
          name: 'Params',
          component: Params
        },
        {
          path: 'orders',
          name: 'Orders',
          component: Orders
        },
        {
          path: 'reports',
          name: 'Reports',
          component: Reports
        }
      ]
    }
  ]
})
